package first.niuke.simple;

/**
 * @ClassName NC56
 * @description:
 * @author: 荣燊
 * @create: 2021-06-03 19:12
 **/
public class NC56 {
    // 回文数字
    public static boolean isPalindrome (int x) {
        // write code here
        // 不使用额外的空间，整数反转
        if (x < 0) {
            return false;
        }
        int y = 0;
        int tmp = x;
        while (tmp > 0) {
            y = y * 10 + tmp % 10;
            tmp /= 10;
        }
        return x == y;
    }

    public static void main(String[] args) {
        System.out.println(isPalindrome(122333221));
    }
}
